<?php

/**
 * Created by PhpStorm.
 * User: evan
 * Date: 16/9/19
 * Time: 上午1:10
 */
class Detail extends MY_Api_Controller
{
    /**
     * 详情页
     */
    public function index()
    {
        $vid = (int)$this->input->get_post('vid');


        $this->load->service('voice/service_voice_detail');
        $data = $this->service_voice_detail->index($vid, $this->uid);


        unset($data['data']['item']['ip']);


        if (isset($data['data']['rank']))
        {
            foreach ($data['data']['rank'] as $k => $v)
            {
                unset($data['data']['rank'][$k]['ip']);
            }
        }



        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 加载更多呼声
     */
    public function load_more_vote()
    {
        $vid = (int)$this->input->get_post('vid');
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('voice/service_voice_detail');
        $data = $this->service_voice_detail->load_more_vote($vid, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 加载更多留言
     */
    public function load_more_message()
    {
        $vid = (int)$this->input->get_post('vid');
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('voice/service_voice_detail');
        $data = $this->service_voice_detail->load_more_message($vid, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 加载更多呼声榜
     */
    public function load_more_top()
    {
        $vid = (int)$this->input->get_post('vid');
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('voice/service_voice_detail');
        $data = $this->service_voice_detail->load_more_top($page, $limit);


        $this->json_output($data['data'], $data['status']);
    }
}